<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<link href="../../css/demo.css" rel="stylesheet" type="text/css" />
	<script src="../../js/boot.js" type="text/javascript"></script>
	<script src="../../js/zjf_bless/zjf_bless.js" type="text/javascript"></script>
	<script src="../../js/swfupload/swfupload.js" type="text/javascript"></script>
	
    <style type="text/css">
    html, body
    {
        font-size:12px;
        padding:0;
        margin:0;
        border:0;
        height:100%;
        overflow:hidden;
    }
    </style>
</head>
<body>    
     <!-- 数据获取到以name的方式进行装载装载到相应的位置进行显示 -->
    <form id="form1" method="post"  enctype="multipart/form-data"> 
    	<input name="blessId" class="mini-hidden" id="blessId"/>
    	<input name="blessImg" class="mini-hidden" id="blessImg"/>
        <div style="padding-left:11px;padding-bottom:5px;" >
            <table style="table-layout:fixed;margin-top:20px;align:center">
                 <tr style="padding:10px">
                    <td>祝福语名称</td>
                    <td style="padding:10px">    
                        <input name="blessName" required="true"  style="width:180px"  class="mini-textbox" id="blessName"/>
                    </td>
                    <td>所属标签</td>
                    <td style="padding:10px">    
                       <input name="labelId" id="labelId"    class="mini-combobox" style="width:180px;" textField="labelName" valueField="labelId" emptyText="请选择..."
    url="javascript:getRootPath()+'/rest/zjf_label/list_for_bless'"   showNullItem="true" nullItemText="请选择..."/>
                    </td>
                </tr>
                <tr style="padding:10px">
                    <td>标签状态</td>
                    <td style="padding:10px">    
                        <select name="disabledState" class="mini-radiobuttonlist" id="disabledState">
                        	<option value="0">可用</option>
                        	<option value="1">禁用</option>
                    	</select>
                    </td>
                    <td>祝福语图</td>
                    <td style="padding:10px">    
                       <input id="fileupload" class="mini-fileupload" style="width:180px;" limitSize="1MB"  name="file_upload" limitType="*.jpg;*.JPG;*.jpeg;*.JPEG;*.png;*.PNG;*.bmp;*.BMP" flashUrl="../../js/swfupload/swfupload.swf" onuploadsuccess="onUploadSuccess"  onuploaderror="onUploadError" onfileselect="onFileSelect"/>
                    </td>
                    <td style="padding:10px">    
                      <input type="button" value="上传" onclick="startUpload()"/>
                    </td>
                </tr>
            </table>
        </div>
         <div id="tabs1" class="mini-tabs" activeIndex="0" style="width:100%;height:380px;padding-left:10px;" plain="false">
		    <div title="祝福语图片" >
		    	<img id="labelImg_show" name="labelImg_show" src="" style="width:100%;height:auto"></img>
		    </div>
		    
		</div>
        <div style="text-align:center;padding:20px;">               
            <a class="mini-button mini-button-primary" onclick="onOk" style="width:160px;margin-right:30px;">新增(更新)祝福语</a>       
            <a class="mini-button mini-button-primary" onclick="onCancel" style="width:160px;">取     消</a>  
        </div>        
    </form>
    <script type="text/javascript">
        mini.parse();
       	form = new mini.Form("#form1");
       	
		function onUploadSuccess(e) {
        	var data = eval('(' + e.serverData + ')');
     		$("#labelImg_show").attr("src", data.errMsg);
        	var blessImg = mini.get("blessImg");
        	blessImg.setValue(data.errMsg);
            this.setText("");
        }
        function onUploadError(e) {
            alert("上传出错，请重试。" + e.message);
        }

        function startUpload() {
        	var hostUrl = getRootPath();
        	var fileupload = mini.get("fileupload");
            fileupload.setUploadUrl(hostUrl+"/rest/upload/file");
            fileupload.startUpload();
        	
        }
        
        function setImgShow(img_src) {
        	$("#labelImg_show").attr("src", img_src);
        }
       
    </script>
</body>
</html>
